function f = Ackley(x, a, b, c)
% f = ackley(x, a);
% x: variable, a n-d column vector;
% a, b, c: parameters, all of them are real numbers.
    if (nargin < 4)
        c = 2*pi;
    end
    if (nargin < 3)
        b = 0.2;
    end
    if (nargin < 2)
        a = 20;
    end
    n = size(x, 1);
    f = -a * exp(-b * sqrt(1.0 / n * sum(x.^2, 1))) -...
        exp(1.0 / n * sum(cos(c * x), 1)) +...
        exp(1) + a;
end